package com.siyuan2;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @className: UserBeanPostPropercessor
 * @Description: TODO
 * @author: wzq
 * @date: 2022/8/25 16:13
 */
@Component
public class UserBeanPostPropercessor implements BeanPostProcessor {

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		if (beanName.equals("user")){
			System.out.println("user 初始化之前");
		}
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		if (beanName.equals("user")){
			System.out.println("user 初始化之后");
		}
		return bean;
	}
}
